package com.tools.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.tools.entity.Query;

@Repository(value="queryMapper")
public interface QueryMapper {

	List<Query> getAll();
	Query fetchById(int id);
	
	@Insert("insert into query(name,tid,des) values(#{name},#{theme.id},#{des})")
	@Options(keyProperty="id",useGeneratedKeys=true)
	int insert(Query query);
	
	@Delete("delete from query where id=#{id}")
	int delete(int id);
	
	@Update("update query set name=#{name},tid=#{theme.id},des=#{des} where id=#{id}")
	int update(Query query);
}
